package com.momo.apachedoris.dao.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.tomcat.util.codec.binary.Base64;

import java.nio.charset.StandardCharsets;

/**
 * @Author: Jie Li
 * @Version: 1.0
 * @Description: TODO
 * <p>Copyright: Copyright (c) 2023</p >
 * @Date: 2023年03月12 12:54
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DorisConnectionVO {
    private String host = "192.168.189.128";
    private String db = "example_db";
    private String userName = "root";
    private String password = "123qwe";
    private String expect = "100-continue";
    private int httpPort = 8030;


    public String basicAuthHeader() {
        final String tobeEncode = this.userName + ":" + this.password;
        byte[] encoded = Base64.encodeBase64(tobeEncode.getBytes(StandardCharsets.UTF_8));
        return "Basic " + new String(encoded);
    }
}
